<?php
class RssFeedStyle extends AbsFeedStyle {
	public function html() {
		$title = $this->encode($this->data['title']);
		$link = $this->encode($this->data['link']);
		$description = $this->encode($this->data['description']);
		$language = $this->encode($this->data['language']);
		$pubDate = $this->encode($this->data['pubDate']);
		
		// header
		$rss = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
			<rss version=\"2.0\">
				<channel>
					<title>{$title}</title>
					<link>{$link}</link>
					<description>{$description}</description>
					<language>{$language}</language>
					<pubDate>{$pubDate}</pubDate>";
		
		// add rss item
		foreach($this->data['items'] as $item) {
			$title = $this->encode($item['title']);
			$link = $this->encode($item['link']);
			$description = $this->encode($item['description']);
			
			$rss .= "<item>
						<title>{$title}</title>
						<link>{$link}</link>
						<description>{$description}</description>
					</item>";
		}
		
		// footer
		$rss .= "</channel>
			</rss>";
		
		return $rss;
	}
}
?>